import Log from "@ohos.hilog";

const TAG = "[]";
const DOMAIN = 0x0000;

export class LogUtil {
  private static readonly COLON: string = ": ";

  constructor() {
  }

  private static prefix(tag: string) {
    return tag + this.COLON;
  }

  static d(tag: string, msg: string, ...args: any[]) {
    Log.debug(DOMAIN, TAG, this.prefix(tag) + msg, args);
  }

  static i(tag: string, msg: string, ...args: any[]) {
    Log.info(DOMAIN, TAG, this.prefix(tag) + msg, args);
  }

  static w(tag: string, msg: string, ...args: any[]) {
    Log.warn(DOMAIN, TAG, this.prefix(tag) + msg, args);
  }

  static e(tag: string, msg: string, ...args: any[]) {
    Log.error(DOMAIN, TAG, this.prefix(tag) + msg, args);
  }
}

let mLogUtil = new LogUtil();

export default mLogUtil as LogUtil;
